﻿#include "experimenttemperaturewindow.h"
#include "ui_experimenttemperaturewindow.h"

experimentTemperatureWindow::experimentTemperatureWindow(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::experimentTemperatureWindow)
{
    ui->setupUi(this);
}

experimentTemperatureWindow::~experimentTemperatureWindow()
{
    delete ui;
}
void experimentTemperatureWindow::showEvent(QShowEvent *event)
{
    QTimer *timer = new QTimer(this);
    connect(timer,&QTimer::timeout,this,&experimentTemperatureWindow::timerUpdate);
    timer->start(1000);//间隔1s刷新一次
}

void experimentTemperatureWindow::timerUpdate(){
    ui->label_18->setText(QString::number(MainWindow::tempDataOne,'f',2));
    ui->label_19->setText(QString::number(MainWindow::tempDataTwo,'f',2));
    ui->label_20->setText(QString::number(MainWindow::tempDataThree,'f',2));
    ui->label_21->setText(QString::number(MainWindow::tempDataFour,'f',2));
    ui->label_22->setText(QString::number(MainWindow::tempDataFive,'f',2));
    ui->label_23->setText(QString::number(MainWindow::tempDataSix,'f',2));
}

void experimentTemperatureWindow::on_pushButton_clicked()
{
    this->close();
    emit changeMainWindow();
}

void experimentTemperatureWindow::on_pushButton_2_clicked()
{
    this->close();
    emit changeMainWindow();
}

